package longrise.phone.com.bjjt_jyb.myaccident;

import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.longrise.LEAP.Base.Objects.EntityBean;
import com.longrise.android.FormParameter;
import com.longrise.android.LFView;

import longrise.phone.com.bjjt_jyb.R;
import longrise.phone.com.bjjt_jyb.Utils.CommontUtils;


/**
 * 事故对方信息
 */
public class AccidentOtherView extends LFView {

    private Context mContext;

    private View mView;

    private EntityBean baseBean;
    private String issingle;

    public AccidentOtherView(Context context, EntityBean bean,String issingle) {
        super(context);
        this.mContext = context;
        this.baseBean = bean;
        this.issingle=issingle;
    }

    @Override
    public FormParameter getFormParameter() {
        FormParameter form = new FormParameter();
        form.setShowtitle(false);
        return form;
    }

    @Override
    public View getView() {
        return mView;
    }

    @Override
    public void init() {
        if (null == mContext) {
            return;
        }
        mView = LayoutInflater.from(mContext).inflate(R.layout.view_accidentother, null);
        if (mView == null) {
            return;
        }
        //标题栏
        TextView titleTV = (TextView) mView.findViewById(R.id.tv_title);
        TextView tv_new7 = (TextView) mView.findViewById(R.id.tv_new7);
        titleTV.setText(R.string.accident_other_info);
        mView.findViewById(R.id.hn_btn_back).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                closeForm();
                OnDestroy();
            }
        });
        //车牌号
        TextView carnumTV = (TextView) mView.findViewById(R.id.aother_tv_carnum);
        //当事人
        TextView pesronTV = (TextView) mView.findViewById(R.id.aother_tv_person);
        //电话
        TextView phoneTV = (TextView) mView.findViewById(R.id.aother_tv_phone);
        //责任
        TextView dutyTV = (TextView) mView.findViewById(R.id.aother_tv_duty);

        carnumTV.setText(baseBean.getString("casecarno"));
        pesronTV.setText(baseBean.getString("carownname"));
        phoneTV.setText(baseBean.getString("carownphone"));
        dutyTV.setText(CommontUtils.getDutyStr(baseBean.getString("dutytype")));
        if(TextUtils.equals("11", issingle)){
            tv_new7.setText("车辆品牌");
        }
    }

    @Override
    public void refresh() {

    }

    @Override
    public void refreshByTime() {

    }

    @Override
    public void OnDestroy() {
        super.OnDestroy();
        mView = null;
    }
}
